import {reqITDataList,reqNavListData} from '@/api'
const state = {
    ITDataList:[],
    navDataList:[]
}
const actions = {
    //前端模块数据
    async getBackEndList({commit},type){
        const result = await reqITDataList(type)
        if(result.code === 200){
            commit('backList',result.qianduan)
        }
    },
    //后端模块数据
    async getFrontEndList({commit},type){
        const result = await reqITDataList(type)
        if(result.code === 200){
            commit('frontList',result.houduan)
        }
    },
    //请求Andriod数据
    async getAndriodList({commit},type){
        const result = await reqITDataList(type)
        if(result.code === 200){
            commit('AndriodList',result.andriod)
        }
    },
    //请求IOS数据
    async getIOSList({commit},type){
        const result = await reqITDataList(type)
        if(result.code === 200){
            commit('iosList',result.ios)
        }
    },
    //去请求AI数据
    async getAiList({commit},type){
        const result = await reqITDataList(type)
        if(result.code === 200){
            commit('aiList',result.ai)
        }
    },
    //请求数据库数据
    async getDataBaseList({commit},type){
        const result = await reqITDataList(type)
        if(result.code === 200){
            commit('databaseList',result.database)
        }
    },
    //请求开发程序数据
    async getProgramList({commit},type){
        const result = await reqITDataList(type)
        if(result.code === 200){
            commit('programList',result.programDevelopment)
        }
    },
    //获取侧边栏导航数据
    async gitNavList({commit}){
        const result = await reqNavListData()
        if(result.code === 200){
            commit('navList',result.navList.navList)
        }
    }
}
const mutations = {
    //主体内容数据
    backList(state,value){
        state.ITDataList = value
    },
    frontList(state,value){
        state.ITDataList = value
    },
    AndriodList(state,value){
        state.ITDataList = value
    },
    iosList(state,value){
        state.ITDataList = value
    },
    aiList(state,value){
        state.ITDataList = value
    },
    databaseList(state,value){
        state.ITDataList = value
    },
    programList(state,value){
        state.ITDataList = value
    },
    //侧边栏数据
    navList(state,value){
        state.navDataList = value
    }
}
const getters = {

}
export default {
    state,
    actions,
    mutations,
    getters
}